import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
import 'package:get/get.dart';
import 'package:yysk_app/business/announcement_item_widget.dart';
import 'package:yysk_app/model/collection_model/home_first_detail_model.dart';
import 'package:yysk_app/model/common_model/notice_list_model.dart';
import 'package:yysk_app/model/tab_model.dart';
import 'package:yysk_app/pages/nft_pages/home_pages/checkEligibility/checkEligibility_page.dart';
import 'package:yysk_app/pages/nft_pages/home_pages/collection_detail/collection_detail_controller.dart';
import 'package:yysk_app/pages/nft_pages/home_pages/collection_detail/first_pay_footer.dart';
import 'package:yysk_app/pages/nft_pages/home_pages/news_detail/news_detail_page.dart';
import 'package:yysk_app/utils/colors.dart';
import 'package:yysk_app/utils/helper.dart';
import 'package:yysk_app/utils/js_tool.dart';
import 'package:yysk_app/widget/custom_app_bar2.dart';
import 'package:yysk_app/widget/empty_widget.dart';
import 'package:yysk_app/widget/image_asset_widget.dart';
import 'package:yysk_app/widget/lazy_network_image.dart';
import 'package:yysk_app/widget/tab_widget.dart';

class CollectionDetailPage extends GetView<CollectionDetailController> {
  static const String path = '/collectionDetail';
  const CollectionDetailPage({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      backgroundColor: AppColors.backgroundColorBlack,
      body: SafeArea(
        top: false,
        child: Obx(() {
          // final dateil = controller.firstDetail.value;
          double top = MediaQuery.of(context).padding.top;
          return Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Expanded(
                child: ListView(
                  padding: EdgeInsets.fromLTRB(0.px, 0.px, 0.px, 24.px),
                  children: [
                    LayoutBuilder(
                      builder: (
                        BuildContext context,
                        BoxConstraints constraints,
                      ) {
                        return _header(
                          context: context,
                          top: top,
                          controller: controller,
                        );
                      },
                    ),
                    // SizedBox(height: 20.px),
                    if (controller.firstDetail.value?.processList != null)
                      _bodySale(context, controller),
                    Padding(
                      padding: EdgeInsets.only(left: 14.px, right: 14.px),
                      child: Column(
                        children: [
                          _collectTab(context: context, controller: controller),
                          controller.firstDetail.value != null
                              ? _instructions(
                                context: context,
                                controller: controller,
                              )
                              : Text(''),
                               //底部bsn 服务支持
                  SizedBox(
                    width: context.width,
                    height: 101.px,
                    child: Center(
                      child: Image.asset(
                        'static/images/bsn.png',
                        width: 138.px,
                        height: 23.px,
                        fit: BoxFit.fill,
                      ),
                    ),
                  )
                        ],
                      ),
                    ),
                  ],
                ),
              ),
              Obx(
                () =>
                    ((controller.firstDetail.value != null &&
                                controller.firstPublishTime.value != null) ||
                            controller.showBuyButton.value == true)
                        ? FirstPayFooter(
                          controller: controller,
                          // price: '0',
                          // id: 0,
                          type: '1',
                        )
                        : Text(''),
              ),
            ],
          );
        }),
      ),
    );
  }

  _bodySale(BuildContext context, CollectionDetailController controller) {
    var type = 0; // 有0未开始 1优先购 2优先抢 3公售 状态 懒得做枚举
    //类型，PUBLIC-公售，ROB-优先抢，BUY-优先购,可用值:PUBLIC,ROB,BUY
    late bool hasFirstBuy = false;

    late bool hasFirstRob = false;
    ProcessList? hasFirstBuyInfo;
    ProcessList? hasFirstRobInfo;
    ProcessList? buyInfo;
    final processList = controller.firstDetail.value?.processList ?? [];
    for (var element in processList) {
      if (element.processType == 'BUY') {
        hasFirstBuy = true;
        hasFirstBuyInfo = element;
        if (element.processed == true) type = 1;
      }
      if (element.processType == 'ROB') {
        hasFirstRob = true;
        hasFirstRobInfo = element;
        if (element.processed == true) type = 2;
      }
      if (element.processType == 'PUBLIC') {
        buyInfo = element;
        if (element.processed == true) type = 3;
      }
    }
    return Center(
      child: Container(
        width: 347.px,
        padding: EdgeInsets.fromLTRB(6.px, 10.px, 6.px, 10.px),
        margin: EdgeInsets.only(bottom: 50.px),
        decoration: BoxDecoration(
          // color: AppColors.backgroundColorLightGreen
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            SizedBox(
              width: 10.px,
              // color: Colors.amberAccent,
              child: Column(
                children: [
                  SizedBox(height: 8.px),
                  if (hasFirstBuy)
                    Container(
                      width: 6.px,
                      height: 6.px,
                      decoration: BoxDecoration(
                        color:
                            type > 0
                                ? AppColors.startColor
                                : AppColors.backgroundColorGrey,
                        borderRadius: BorderRadius.circular(100),
                      ),
                    ),
                  if (hasFirstBuy)
                    Container(
                      width: 1.px,
                      height: 87.px,
                      decoration: BoxDecoration(
                        color:
                            type > 1
                                ? Color.fromRGBO(57, 231, 255, 0.5)
                                : AppColors.backgroundColorGrey,
                        borderRadius: BorderRadius.circular(100),
                      ),
                    ),
                  if (hasFirstRob)
                    Container(
                      width: 6.px,
                      height: 6.px,
                      decoration: BoxDecoration(
                        color:
                            type > 1
                                ? AppColors.startColor
                                : AppColors.backgroundColorGrey,
                        borderRadius: BorderRadius.circular(100),
                      ),
                    ),
                  if (hasFirstRob)
                    Container(
                      width: 1.px,
                      height: 87.px,
                      decoration: BoxDecoration(
                        color:
                            type > 2
                                ? Color.fromRGBO(57, 231, 255, 0.5)
                                : AppColors.backgroundColorGrey,
                        borderRadius: BorderRadius.circular(100),
                      ),
                    ),
                  Container(
                    width: 6.px,
                    height: 6.px,
                    decoration: BoxDecoration(
                      color:
                          type > 2
                              ? AppColors.startColor
                              : AppColors.backgroundColorGrey,
                      borderRadius: BorderRadius.circular(100),
                    ),
                  ),
                ],
              ),
            ),
            SizedBox(
              width: 309.px,
              child: Column(
                children: [
                  if (hasFirstBuy)
                    Container(
                      width: 309.px,
                      margin: EdgeInsets.only(bottom: 28.px),
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.start,
                        children: [
                          Row(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            mainAxisAlignment: MainAxisAlignment.start,
                            children: [
                              Text(
                                '优先购',
                                style: TextStyle(
                                  color: AppColors.backgroundColor,
                                  fontSize: 14.px,
                                ),
                              ),
                              SizedBox(width: 8.px),
                              InkWell(
                                onTap: () {
                                  Get.toNamed(
                                    '${CheckEligibilityPage.path}?id=${controller.firstDetail.value?.id}&processType=BUY',
                                    arguments: {
                                      'id':
                                          '${controller.firstDetail.value?.id}',
                                      'processType': 'BUY',
                                    },
                                  );
                                },
                                child: Text(
                                  '获悉资格 >',
                                  style: TextStyle(
                                    color: AppColors.backgroundColorGrey,
                                    fontSize: 12.px,
                                  ),
                                ),
                              ),
                            ],
                          ),
                          SizedBox(height: 10.px),
                          Row(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Column(
                                children: [
                                  Text(
                                    '开始时间：${hasFirstBuyInfo!.startTime}',
                                    style: TextStyle(
                                      color: AppColors.backgroundColorGrey,
                                      fontSize: 12.px,
                                    ),
                                  ),
                                  Text(
                                    '结束时间：${hasFirstBuyInfo!.endTime}',
                                    style: TextStyle(
                                      color: AppColors.backgroundColorGrey,
                                      fontSize: 12.px,
                                    ),
                                  ),
                                ],
                              ),
                              Text(
                                '限购：${hasFirstBuyInfo.limitDesc}',
                                style: TextStyle(
                                  color: AppColors.backgroundColorGrey,
                                  fontSize: 12.px,
                                ),
                              ),
                            ],
                          ),
                        ],
                      ),
                    ),
                  if (hasFirstRob)
                    Container(
                      width: 309.px,
                      margin: EdgeInsets.only(bottom: 28.px),
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.start,
                        children: [
                          Row(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            mainAxisAlignment: MainAxisAlignment.start,
                            children: [
                              Text(
                                '优先抢',
                                style: TextStyle(
                                  color: AppColors.backgroundColor,
                                  fontSize: 14.px,
                                ),
                              ),
                              SizedBox(width: 8.px),
                              GestureDetector(
                                onTap: () {},
                                child: InkWell(
                                  onTap: () {
                                    Get.toNamed(
                                      '${CheckEligibilityPage.path}?id=${controller.firstDetail.value?.id}&processType=ROB',
                                      arguments: {
                                        'id':
                                            '${controller.firstDetail.value?.id}',
                                        'processType': 'ROB',
                                      },
                                    );
                                  },
                                  child: Text(
                                    '获悉资格 >',
                                    style: TextStyle(
                                      color: AppColors.backgroundColorGrey,
                                      fontSize: 12.px,
                                    ),
                                  ),
                                ),
                              ),
                            ],
                          ),
                          SizedBox(height: 10.px),
                          Row(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Column(
                                children: [
                                  Text(
                                    '开始时间：${hasFirstRobInfo!.startTime}',
                                    style: TextStyle(
                                      color: AppColors.backgroundColorGrey,
                                      fontSize: 12.px,
                                    ),
                                  ),
                                  Text(
                                    '结束时间：${hasFirstRobInfo!.endTime}',
                                    style: TextStyle(
                                      color: AppColors.backgroundColorGrey,
                                      fontSize: 12.px,
                                    ),
                                  ),
                                ],
                              ),
                              Text(
                                '限购：${hasFirstRobInfo!.limitDesc}',
                                style: TextStyle(
                                  color: AppColors.backgroundColorGrey,
                                  fontSize: 12.px,
                                ),
                              ),
                            ],
                          ),
                        ],
                      ),
                    ),
                  SizedBox(
                    width: 309.px,
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        Row(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: [
                            Text(
                              '公售',
                              style: TextStyle(
                                color: AppColors.backgroundColor,
                                fontSize: 14.px,
                              ),
                            ),
                            SizedBox(width: 8.px),
                            GestureDetector(
                              onTap: () {
                                Get.toNamed(
                                  '${CheckEligibilityPage.path}?id=${controller.firstDetail.value?.sourceId}&processType=PUBLIC',
                                  arguments: {
                                    'id':
                                        '${controller.firstDetail.value?.sourceId}',
                                    'processType': 'PUBLIC',
                                  },
                                );
                              },
                              child: GestureDetector(
                                onTap: () {
                                  Get.toNamed(
                                    CheckEligibilityPage.path,
                                    arguments: {},
                                  );
                                }, //
                                child: InkWell(
                                  onTap: () {},
                                  child: Text(
                                    '',
                                    style: TextStyle(
                                      color: AppColors.backgroundColorGrey,
                                      fontSize: 12.px,
                                    ),
                                  ),
                                ),
                              ),
                            ),
                          ],
                        ),
                        SizedBox(height: 10.px),
                        Row(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Column(
                              children: [
                                Text(
                                  '开始时间：${buyInfo!.startTime}',
                                  style: TextStyle(
                                    color: AppColors.backgroundColorGrey,
                                    fontSize: 12.px,
                                  ),
                                ),
                                Text(
                                  '结束时间：${buyInfo!.endTime}',
                                  style: TextStyle(
                                    color: AppColors.backgroundColorGrey,
                                    fontSize: 12.px,
                                  ),
                                ),
                              ],
                            ),
                            Text(
                              '限购：${buyInfo.limitDesc}',
                              style: TextStyle(
                                color: AppColors.backgroundColorGrey,
                                fontSize: 12.px,
                              ),
                            ),
                          ],
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }

  _header({
    required BuildContext context,
    double top = 0,
    required CollectionDetailController controller,
  }) {
    final detail = controller.firstDetail.value;
    return Obx(
      () => Stack(
        children: [
          SizedBox(
            width: context.width,
            // decoration: BoxDecoration(color: AppColors.fontColorGrey),
            child: Column(
              children: [
                SizedBox(
                  width: context.width,
                  child: ImageAssetWidget(
                    width: 375.px,
                    height: 582.px,
                    imageUrl: 'static/images/bg.png',
                  ),
                ),
              ],
            ),
          ),
          Container(
            width: context.width,
            padding: EdgeInsets.only(top: (400.px)),
            child: Column(
              children: [
                Center(
                  child: ImageAssetWidget(
                    width: 375.px,
                    height: 133.px,
                    fit: BoxFit.cover,
                    imageUrl: 'static/images/bg3.png',
                  ),
                ),
              ],
            ),
          ),
          Container(
            padding: EdgeInsets.only(top: top),
            child: CustomAppBar2(title: '', context: context),
          ),
          Container(
            margin: EdgeInsets.only(top: 140.px),
            decoration: BoxDecoration(
              // color: AppColors.backgroundColor00
            ),
            child: Center(
              child: LazyImage(
                imageUrl: '${controller.firstDetail.value?.coverImageUrl}',
                width: 200.px,
                height: 200.px,
                boxFit: BoxFit.fitHeight,
                alignment: Alignment.topCenter,
              ),
            ),
          ),
          Positioned(
            left: 0,
            right: 0,
            top: 477.px,
            child: Container(
              width: context.width,
              height: 60.px,

              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    controller.firstDetail.value?.productName ?? '',
                    textAlign: TextAlign.center,
                    style: TextStyle(
                      fontSize: 18.px,
                      color: AppColors.fontColor,
                      overflow: TextOverflow.ellipsis,
                    ),
                  ),
                  SizedBox(height: 10.px),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Container(
                        height: 21.px,
                        clipBehavior: Clip.antiAlias,
                        decoration: BoxDecoration(
                          // color: const Color.fromRGBO(255, 238, 192, 1),
                          borderRadius: BorderRadius.circular(4.px),
                          color: AppColors.startColor,
                          border: Border.all(
                            width: 1.px,
                            color: AppColors.startColor,
                          ),
                        ),
                        margin: EdgeInsets.fromLTRB(12.px, 0, 12.px, 0),
                        padding: EdgeInsets.fromLTRB(0.px, 0, 0.px, 0),
                        child: Center(
                          child: Row(
                            children: [
                              SizedBox(
                                width: 36.px,
                                child: Stack(
                                  children: [
                                    Center(
                                      child: Text(
                                        '限量',
                                        style: TextStyle(
                                          color: Colors.black,
                                          fontSize: 10.px,
                                        ),
                                      ),
                                    ),
                                  ],
                                ),
                              ),

                              Container(
                                padding: EdgeInsets.fromLTRB(3.px, 0, 11.px, 0),
                                height: 22.px,
                                decoration: BoxDecoration(
                                  borderRadius: BorderRadius.only(
                                    topRight: Radius.circular(4.px),
                                    bottomRight: Radius.circular(4.px),
                                  ),
                                  color: AppColors.backgroundColorBlack,
                                ),
                                child: Center(
                                  child: Text(
                                    '${controller.firstDetail.value?.firstPublishCount ?? '0'}',
                                    style: TextStyle(
                                      color: AppColors.startColor,
                                      fontSize: 10.px,
                                    ),
                                  ),
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),

                      Container(
                        height: 21.px,
                        decoration: BoxDecoration(
                          // color: const Color.fromRGBO(255, 238, 192, 1),
                          borderRadius: BorderRadius.circular(4.px),
                          color: AppColors.startColor,
                          border: Border.all(
                            width: 1.px,
                            color: AppColors.startColor,
                          ),
                        ),
                        margin: EdgeInsets.fromLTRB(12.px, 0, 12.px, 0),
                        padding: EdgeInsets.fromLTRB(0.px, 0, 0.px, 0),
                        child: Center(
                          child: Row(
                            children: [
                              SizedBox(
                                width: 36.px,
                                child: Stack(
                                  children: [
                                    Center(
                                      child: Text(
                                        '发行方',
                                        style: TextStyle(
                                          color: Colors.black,
                                          fontSize: 10.px,
                                        ),
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                              Container(
                                padding: EdgeInsets.fromLTRB(3.px, 0, 11.px, 0),
                                height: 22.px,
                                decoration: BoxDecoration(
                                  borderRadius: BorderRadius.only(
                                    topRight: Radius.circular(4.px),
                                    bottomRight: Radius.circular(4.px),
                                  ),
                                  color: AppColors.backgroundColorBlack,
                                ),
                                child: Center(
                                  child: Text(
                                    controller.firstDetail.value?.daoName ?? '',
                                    style: TextStyle(
                                      color: AppColors.startColor,
                                      fontSize: 10.px,
                                    ),
                                  ),
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ),

          // Positioned(
          //   bottom: 0,
          //   left: 14.px,
          //   right: 14.px,
          //   child: Stack(
          //     children: [

          //       Center(
          //         child: Container(
          //           clipBehavior: Clip.antiAlias,
          //           decoration: BoxDecoration(
          //             borderRadius: BorderRadius.circular(8.px),
          //             color: AppColors.backgroundColor,
          //           ),
          //           padding: EdgeInsets.fromLTRB(5.px, 18.px, 23.px, 18.px),
          //           child: Row(
          //             crossAxisAlignment: CrossAxisAlignment.center,
          //             children: [
          //               LazyImage(
          //                 imageUrl:
          //                     '${controller.firstDetail.value?.daoHeadImageUrl}',
          //                 width: 38.px,
          //                 height: 38.px,
          //                 boxFit: BoxFit.fitHeight,
          //                 alignment: Alignment.topCenter,
          //                 borderRadius: 100,
          //               ),
          //               SizedBox(width: 18.px),
          //               Expanded(
          //                 child: Text(
          //                   controller.firstDetail.value?.daoName ?? '',
          //                   textAlign: TextAlign.left,
          //                   style: TextStyle(
          //                     fontSize: 18.px,
          //                     color: AppColors.fontColorBlack,
          //                     overflow: TextOverflow.ellipsis,
          //                     fontWeight: FontWeight.w400,
          //                   ),
          //                 ),
          //               ),
          //               SizedBox(width: 18.px),
          //               Icon(
          //                 Icons.arrow_forward_ios,
          //                 color: AppColors.fontColorGreen.withValues(alpha: 0),
          //                 size: 14.px,
          //               ),
          //             ],
          //           ),
          //           // child:
          //         ),
          //       ),
          //     ],
          //   ),
          // ),
        ],
      ),
    );
  }

  _collectTab({
    required BuildContext context,
    required CollectionDetailController controller,
  }) {
    final detail = controller.firstDetail.value;
    return Container(
      width: context.width,
      margin: EdgeInsets.only(bottom: 10.px),
      padding: EdgeInsets.fromLTRB(0.px, 0.px, 0.px, 0.px),
      clipBehavior: Clip.antiAlias,
      decoration: BoxDecoration(),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            color: Colors.transparent,
            child: Padding(
              padding: EdgeInsets.fromLTRB(12.px, 0, 12.px, 0),
              child: Column(
                children: [
                  TabWidget(
                    isCurrentFontSize: 18,
                    notCurrentFontSize: 16,
                    tabColor: AppColors.fontColorGreenA9,
                    activeColor: AppColors.fontColor,
                    currentUndelineColorStart: Color.fromRGBO(0, 234, 255, 1),
                    currentUndelineColorEnd: Color.fromRGBO(0, 193, 242, 0.06),
                    currentUndeline: true,
                    tabList: [
                      TabModel(code: 'detail', label: '藏品详情'),
                      TabModel(code: 'ann', label: '相关公告'),
                    ],
                    onChanged: (value) {
                      controller.currentTab.value = value;
                    },
                  ),
                ],
              ),
            ),
          ),
          if (controller.currentTab.value == 'detail')
            Container(
              width: context.width,
              margin: EdgeInsets.only(bottom: 10.px),
              padding: EdgeInsets.fromLTRB(14.px, 14.px, 14.px, 21.px),
              clipBehavior: Clip.antiAlias,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(8.px),
                color: AppColors.backgroundColorGrey2,
                boxShadow: [
                  BoxShadow(
                    color: AppColors.backgroundColorBlack.withAlpha(25),
                    offset: const Offset(0, 14),
                    blurRadius: 24,
                    spreadRadius: 0,
                  ),
                ],
              ),
              child: HtmlWidget(
                ''' <div>
                        ${detail?.collectionDesc}
                        </div>
                        ''',
                textStyle: const TextStyle(
                  color: AppColors.backgroundColorGrey,
                ),
                customWidgetBuilder: (element) {
                  if (element.localName == 'img') {
                    // consoleLog('String===${element.attributes['src']}');
                    return LazyImage(
                      imageUrl: '${element.attributes['src']}',
                      boxFit: BoxFit.fitWidth,
                      width: context.width,
                      aotuHeight: true,
                    );
                  }
                  return null;
                },
              ),
            ),
          if (controller.currentTab.value == 'ann')
            SizedBox(
              width: context.width,
              child: Column(
                children: [_buildPlatformList(controller.noticeList, context)],
              ),
            ),
        ],
      ),
    );
  }

  _instructions({
    required BuildContext context,
    required CollectionDetailController controller,
  }) {
    final detail = controller.firstDetail.value;
    return Container(
      width: context.width,
      margin: EdgeInsets.only(bottom: 10.px),
      padding: EdgeInsets.fromLTRB(14.px, 0.px, 14.px, 21.px),
      clipBehavior: Clip.antiAlias,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(8.px),
        color: AppColors.backgroundColorGrey2,
        boxShadow: [
          BoxShadow(
            color: AppColors.backgroundColorBlack.withAlpha(25),
            offset: const Offset(0, 14),
            blurRadius: 24,
            spreadRadius: 0,
          ),
        ],
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          _midwidget(context: context),
          SizedBox(
            width: context.width,
            child: HtmlWidget(
              ''' <div>
                        ${detail?.collectionNotice}
                        </div>
                        ''',
              textStyle: const TextStyle(color: AppColors.backgroundColorGrey),
              customWidgetBuilder: (element) {
                if (element.localName == 'img') {
                  // consoleLog('String===${element.attributes['src']}');
                  return LazyImage(
                    imageUrl: '${element.attributes['src']}',
                    boxFit: BoxFit.fitWidth,
                    width: context.width,
                    aotuHeight: true,
                  );
                }
                return null;
              },
            ),
            // Text(
            //   '${detail?.collectionNotice}',
            //   style: TextStyle(fontSize: 12.px, color: AppColors.fontColorGrey),
            // ),
          ),
        ],
      ),
    );
  }

  //中间区域
  _midwidget({required BuildContext context}) {
    return Container(
      width: context.width,
      color: Colors.transparent,
      padding: EdgeInsets.fromLTRB(0, 20.px, 0, 20.px),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          ImageAssetWidget(
            imageUrl: 'static/images/home/zuizi.png',
            width: 24.px,
            height: 24.px,
          ),
          SizedBox(width: 8.px),
          Text(
            '购买须知',
            style: TextStyle(fontSize: 18.px, color: AppColors.fontColor),
          ),
          SizedBox(width: 8.px),
          ImageAssetWidget(
            imageUrl: 'static/images/home/zuizi.png',
            width: 24.px,
            height: 24.px,
          ),
        ],
      ),
    );
  }

  //中间公告
  Widget _buildPlatformList(List<NoticeListItem> list, BuildContext context) {
    return list.isEmpty
        ? const EmptyWidget()
        : Column(
          children: [
            ...list.map((e) {
              return GestureDetector(
                onTap: () {
                  Get.toNamed(
                    NewsDetailPage.path,
                    arguments: {
                      'id': e.id,
                      'content': e.content,
                      'title': e.title,
                      'labelName': e.labelName,
                      'createTime': e.createTime,
                    },
                  );
                },
                child: Container(
                  padding: EdgeInsets.all(16.px),
                  margin: EdgeInsets.only(bottom: 10.px),
                  width: context.width,
                  decoration: BoxDecoration(
                    color: AppColors.backgroundColorGrey2,
                    borderRadius: BorderRadius.circular(8.px),
                  ),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Row(
                        children: [
                          SizedBox(
                            width: 300.px,
                            child: Text(
                              e.title ?? '',
                              style: TextStyle(
                                color: AppColors.grey100,
                                fontSize: 14.px,
                                fontWeight: FontWeight.w700,
                                overflow: TextOverflow.ellipsis,
                              ),
                            ),
                          ),
                        ],
                      ),
                      SizedBox(height: 8.px),
                      Container(
                        width: context.width,
                        margin: EdgeInsets.fromLTRB(0, 14.px, 0, 14.px),
                        color: AppColors.backgroundColorGrey,
                        height: 1.px,
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            '${e.createTime}',
                            maxLines: 2,
                            overflow: TextOverflow.ellipsis,
                            textAlign: TextAlign.left,
                            style: TextStyle(
                              color: AppColors.fontColorGrey,
                              fontSize: 13.px,
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                          Row(
                            children: [
                              Text(
                                '查看详情',
                                style: TextStyle(
                                  color: AppColors.fontColorGrey,
                                  fontSize: 13.px,
                                ),
                              ),
                              SizedBox(width: 4.px),
                              Icon(
                                Icons.chevron_right_outlined,
                                color: AppColors.fontColorGrey,
                                size: 14.px,
                              ),
                            ],
                          ),
                        ],
                      ),
                    ],
                  ),
                ),
              );
            }),
          ],
        );
  }
}
